from comment.utils.Serializers import BaseListSerializer, BaseSerializer


class InvitedListSerializer(BaseListSerializer):
    """ 邀请名单列表的序列化 """

    def to_dict(self):
        list = []
        for obj in self.data_list:
            list.append(
                {
                    'name': obj.username,
                    'registerTime': obj.registerTime.strftime("%Y-%m-%d"),
                    "award": '代金券50',
                }
            )
        return list


class UserInfoSerializer(BaseSerializer):
    """用户信息序列化"""

    def to_dict(self):
        obj = self.data
        return {
            'id': obj.username,
            "realNameAuth": obj.realNameStatus,
            "phoneStatus": obj.phone,
            'loginPwdstatus': 1,
            "payPwdStatus": obj.payPwdStatus,
            'avatar': obj.avatar,
            'invite_code': obj.inviteId,
            'phone': obj.phone
        }